/*
** xfunctions.c for  in /home/gomes_m//svn/tek2/zappy-2016-gomes_m/reseau/server
** 
** Made by mickael gomes
** Login   <gomes_m@epitech.net>
** 
** Started on  Tue Jun 25 17:37:11 2013 mickael gomes
** Last update Mon Jul 29 14:59:28 2013 mickael gomes
*/

#include		<stdlib.h>
#include		<netdb.h>
#include		<sys/types.h>
#include		<sys/socket.h>
#include		"struct.h"
#include		"prototypes.h"

int			xatoi(char *str)
{
  int			nbr;

  if ((nbr = atoi(str)) == -1)
    my_putstr(2, "Atoi Error.\n", 1);
  return (nbr);
}

struct protoent		*xgetprotobyname(char *proto)
{
  struct protoent	*pe;

  if ((pe = getprotobyname(proto)) == NULL)
    my_putstr(2, "Getprotobyname Error.\n", 1);
  return (pe);
}

int			xsocket(int domain, int type, int protocol)
{
  int			sock;

  if ((sock = socket(domain, type, protocol)) == -1)
    my_putstr(2, "Socket Error.\n", 1);
  return (sock);
}
